package com.gc;

import com.sun.org.apache.regexp.internal.RE;

import java.lang.ref.SoftReference;

/**
 * Created by Lxk on 2019/2/23.
 */
public class ReferenceCountingGC {

    public Object instance = null;

    private static final int _1MB = 1024*1024;

    private byte[] bigSize = new byte[2*_1MB];

    public static void main(String[] args){
        ReferenceCountingGC obA = new ReferenceCountingGC();
        ReferenceCountingGC obB = new ReferenceCountingGC();

        obA.instance = obB;
        obB.instance = obA;

        obA = null;
        obB = null;

        SoftReference<Integer> ref = new SoftReference<Integer>(2);
        System.gc();
    }
}
